﻿<?php
include("inc/global.inc");
$url=$_SERVER['HTTP_REFERER'];
if($_POST['inquire_act']){
if($_SESSION['code']!=$_POST["c_code"]){
	echo"<script>alert('验证码错误');location='JavaScript:history.go(-1)';</script>";exit;
	}else{
	
	  mysql_query("insert into m_message (member_id,m_subject,m_web,m_content,m_name,m_tel,m_email,m_qq,m_addr,add_time,ip) values ('".$_POST['to_id']."','$_POST[inquire_subject]','$url','$_POST[inquire_content]','$_POST[inquire_name]','$_POST[inquire_tel]','$_POST[inquire_email]','$_POST[inquire_qq]','$_POST[inquire_addr]','".date("Y-m-d,H:i:s")."','".ip()."')");
	   
	   $mail_rs=mysql_query("select m_user,m_email,m_phone from member where id=".$_POST['to_id']); 
	   $mail_row=mysql_fetch_array($mail_rs);
	   
	   //发送短信
			
			
					 $_tel = $mail_row['m_phone'];
				 $_title="三帝贸易网提示：您有一条客户采购留言,请登陆会员助手查看,www.sandib2b.cn";
				 sendtel($_tel,$_title);
					 
					 $content=iconv("utf-8","gb2312","<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd'>
<HTML xmlns='http://www.w3.org/1999/xhtml'>
<HEAD>
<TITLE>邮件来自三帝贸易网</TITLE>
<style type='text/css'>
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	font-size: 12px;
	FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
	background-color: #FFFFFF;
}
a:link {
	color: #003399;
	text-decoration: underline;
}
a:hover {
	color: #FF6600;
	text-decoration: underline;
}
a:active {
	color: #003399;
	text-decoration: underline;
}
a:visited {
	color: #003399;
	text-decoration: underline;
}



#mail {
	padding: 0px;
	width: 622px;
	margin-top: 0px;
	margin-right: auto;
	margin-bottom: 0px;
	margin-left: auto;
	border-right-width: 1px;
	border-left-width: 1px;
	border-right-style: solid;
	border-left-style: solid;
	border-right-color: #ECE9D8;
	border-left-color: #ECE9D8;
}
#mail .info .to {
	line-height: 22px;
}

#mail .info .title {
	font-family: Arial;
	font-size: 19px;
	padding: 5px;
	background-color: #EBEBEB;
}

#mail .logo {
	float: left;
	padding-top: 13px;
}
#mail .headbg {
	float: right;
}
#mail .info {
	padding: 10px;
}
#mail .info .note {
	background-color: #ECF3FB;
	padding: 5px;
	line-height: 18px;
}

#mail .foot {
	background-color: #7EB1DA;
	padding: 6px;
	text-align: right;
}

.onl {
	clear: both;
}
-->
</style>
</HEAD>
<BODY>
<div id='mail'>
<div class='logo'><img src='http://www.sandib2b.cn/images/logo.gif' width='388' height='60'></div>
<div class='headbg'><img src='http://www.sandib2b.cn/images/headbg.gif' width='220' height='75'></div>
<div class='onl'></div>
<table width='100%' border='0' cellpadding='0' cellspacing='0'>
  <tr>
    <td height='42' align='right' valign='bottom' background='http://www.sandib2b.cn/images/webbg.gif'><img src='http://www.sandib2b.cn/images/messbg.gif' width='257' height='28'></td>
    </tr>
</table>
<div class='info'>
  <table cellspacing='0' cellpadding='0' width='100%' align='center' border='0'>
    <tbody>
      <tr>
        <td width='593' height='300' valign='top'><div><strong>您好,"."$mail_row[m_user]"."</strong><div class='to'></div>
          <div class='title'>询价邮件</div>
          <table border='0' align='center' cellpadding='2' cellspacing='1' bgcolor='#FFFFFF'>
                  <tbody>
                    <tr>
                      <th width='123' height='25'>主题</th>
                      <td width='459' height='25'>三帝贸易网-询价邮件</td>
                    </tr>
                    <tr bgcolor='#f7f7f7'>
                      <th>详细内容</th>
                      <td height='100' valign='top'>您有一封新的询价邮件</td>
                    </tr>
					<tr bgcolor='#f7f7f7'>
                      <th height='35'>会员登陆</th>
                      <td><a href='http://www.sandib2b.cn/login'>http://www.sandib2b.cn/login</a></td>
                    </tr>
					<tr bgcolor='#f7f7f7'>
                      <th height='35'></th>
                      <td>警告：系统邮件请勿回复！</td>
                    </tr>
                  </tbody>
              </table>
          </div>
          </td>
      </tr>
    </tbody>
  </table>
</div>
<div class='foot'>国内专业网上商品贸易平台<font color='#CC0000'>三帝贸易网</font></div>
</div>
</BODY>
</HTML>");
					 
                     
					 sendmail($mail_row['m_email'],"询价邮件来自三帝贸易网",$content);
                     //sent email end
	  
		    
		echo "<script>alert('留言发送成功');location='$url';</script>";exit;

	}
}
?>